import {
	http
}  from '../tools/service.js'

const path = '/wallet-allinpay-api'

/**
 * 获取缓存的订单
 */
export const getCacheOrderInfo = (key) => {
	return http.get(`${path}/gateway/bank/order/cache?key=${key}`, {}, {
		header: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	})
}

/**
 * 小程序下单
 */
export const orderMiniapp = (params) => {
	return http.post(`${path}/gateway/bank/orderMiniapp`, params, {
		header: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	})
}

/**
 * 获取小程序openId
 * payMethod
 */
export const getUserOpenId = (params) => {
	return http.post(`${path}/gateway/bank/getUserInfo`, params, {
		header: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	})
}

/**
 * 重新获取旧订单的支付信息
 */
export const rePayOrder = (orderNo) => {
	let data = {
		orderNo: orderNo
	}
	return http.post(path + "/gateway/bank/rePayOrder", data, {
		header: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	})
}